﻿<UserControl x:Class="TestCaseManagerApp.Views.AssociateTestView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             xmlns:helpers="clr-namespace:TestCaseManagerCore.Helpers;assembly=TestCaseManagerCore"
             mc:Ignorable="d">
    <Grid>
        <Grid Name="mainGrid">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <StackPanel Orientation="Vertical">
                <TextBlock Text="Associate Automation" Margin="10,0,10,30" Height="Auto" FontWeight="Bold" FontSize="26" HorizontalAlignment="Left" Grid.Row="0" Grid.ColumnSpan="2"/>
                <TextBlock Text="{Binding TestCase.ITestCase.Title}" Margin="10,0,10,30" Height="25" FontWeight="Bold" FontSize="18" HorizontalAlignment="Left" Grid.Row="0" Grid.ColumnSpan="2"/>
            </StackPanel>           
            <Grid  Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <TextBox Name="tbFullName" Text="{Binding AssociateTestViewFilters.FullNameFilter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10,0,10,10" Height="25" GotFocus="tbFullName_GotFocus" LostFocus="tbFullName_LostFocus" KeyUp="tbFullName_KeyUp" Grid.Column="0" HorizontalAlignment="Stretch"/>
                <TextBox Name="tbClassName" Text="{Binding AssociateTestViewFilters.ClassNameFilter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10,0,10,10" Height="25"  GotFocus="tbClassName_GotFocus" LostFocus="tbClassName_LostFocus" KeyUp="tbClassName_KeyUp" Grid.Column="1" HorizontalAlignment="Stretch"/>
                <ComboBox Height="25" Margin="10,0,10,10" ItemsSource="{Binding TestTypes}" Name="cbTestType" helpers:ComboBoxDropdownExtensions.OpenDropDownAutomatically="True" MouseEnter="cbTestType_MouseEnter" MouseMove="cbTestType_MouseMove" Grid.Column="2" HorizontalAlignment="Stretch"/>
            </Grid>

            <DataGrid ItemsSource="{Binding ObservableTests}" AutoGenerateColumns="False" Name="dgTests" Grid.Row="2" IsReadOnly="True" SelectionMode="Single">
                <DataGrid.ItemContainerStyle>
                    <Style TargetType="{x:Type DataGridRow}"  BasedOn="{StaticResource {x:Type DataGridRow}}">
                        <EventSetter Event="MouseDoubleClick" Handler="dgTests_MouseDoubleClick" />
                    </Style>
                </DataGrid.ItemContainerStyle>

                <DataGrid.Columns>
                        <DataGridTextColumn Header="FullName" Binding="{Binding FullName}"/>
                        <DataGridTextColumn Header="ClassName" Binding="{Binding ClassName}"/>
                </DataGrid.Columns>
            </DataGrid>
            
            <StackPanel Orientation="Vertical" Grid.Row="3" Margin="0,30,0,30">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                    <Button Name="btnAssociate" Margin="0,0,10,0" Height="30" Width="90" VerticalAlignment="Center" Click="btnAssociate_Click">
                        <Button.Content>
                            <TextBlock>
                                  <Underline>A</Underline>ssociate
                            </TextBlock>
                        </Button.Content>
                    </Button>
                  
                </StackPanel>
            </StackPanel>
        </Grid>
    </Grid>    
</UserControl>
